<%@ page language="java"
    pageEncoding="UTF-8"%>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>会员登录</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
		<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		<!-- 引入自定义css文件 style.css -->
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />

		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
				width: 100%;
			}
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>

		<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
		<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

	</head>

	<body>
		
			<%--静态包含
				包含jsp页面不需要翻译和编译,节省内存!
			--%>
			<%@include file="header.jsp"%>
			<%--动态包含
				包含的jsp页面需要被单独的翻译和编译,比较占用内存!
			--%>
			<%--<jsp:include page="header.jsp"/>--%>

		<div class="row" style="width:1210px;margin:0 auto;">
			<div class="col-md-12">
				<ol class="breadcrumb">
					<li><a href="${pageContext.request.contextPath}/index">首页</a></li>
				</ol>
			</div>

			<%--展示商品分页数据--%>
			<c:forEach items="${pb.pageList}" var="p">
				<div class="col-md-2">
					<a href="${pageContext.request.contextPath}/product?methodName=getProduct&pid=${p.pid}">
						<img src="${pageContext.request.contextPath}/${p.pimage}" width="170" height="170" style="display: inline-block;">
					</a>
					<p><a href="${pageContext.request.contextPath}/product?methodName=getProduct&pid=${p.pid}" style='color:green'>${fn:substring(p.pname,0 ,6 )}...</a></p>
					<p><font color="#FF0000">商城价：&yen;${p.shop_price}</font></p>
				</div>
			</c:forEach>

<%--
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10002.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>圆白菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>

			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10003.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>甜玉米</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>

			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10004.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>胡萝卜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10005.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>芹菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>

			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10006.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>韭菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>

			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10007.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>香菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10008.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>土豆</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10007.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>香菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10008.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>土豆</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10007.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>香菜</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>
			<div class="col-md-2">
				<a href="product_info.htm">
					<img src="${pageContext.request.contextPath}/products/1/cs10008.jpg" width="170" height="170" style="display: inline-block;">
				</a>
				<p><a href="product_info.html" style='color:green'>土豆</a></p>
				<p><font color="#FF0000">商城价：&yen;299.00</font></p>
			</div>--%>

		</div>

		<!--分页 -->
		<div style="width:380px;margin:0 auto;margin-top:50px;">
			<ul class="pagination" style="text-align:center; margin-top:10px;">
				<%--
					判断如果是第一页
				--%>
				<c:if test="${pb.currentPage==1}">
					<li class="disabled">
						<a href="javascript:void(0)" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
					</li>
				</c:if>
				<%--判断如果不是第一页--%>
				<c:if test="${pb.currentPage!=1}">
					<li>
						<a href="${pageContext.request.contextPath}/product?methodName=getProductByPage&curPage=${pb.currentPage-1}&pSize=12&cid=${param.cid}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
					</li>
				</c:if>


				<%--遍历页码--%>
				<c:forEach begin="1" end="${pb.totalPage}" var="n">
					<%--是否是当前页--%>
					<c:if test="${pb.currentPage==n}">
						<%--是当前页--%>
						<li class="active">
							<a href="#">${n}</a>
						</li>

					</c:if>
					<%--不是当前页--%>
					<c:if test="${pb.currentPage!=n}">
						<%--不是当前页--%>
						<li>
							<a href="${pageContext.request.contextPath}/product?methodName=getProductByPage&curPage=${n}&pSize=12&cid=${param.cid}">${n}</a>
						</li>

					</c:if>

				</c:forEach>

				<%--<li><a href="#">2</a></li>
				<li><a href="#">3</a></li>
				<li><a href="#">4</a></li>
				<li><a href="#">5</a></li>
				<li><a href="#">6</a></li>
				<li><a href="#">7</a></li>
				<li><a href="#">8</a></li>
				<li><a href="#">9</a></li>--%>
					<%--判断如果是最后一页--%>
				<c:if test="${pb.currentPage==pb.totalPage}">
					<li class="disabled">
						<a href="javascript:void(0)" aria-label="Next">
							<span aria-hidden="true">&raquo;</span>
						</a>
					</li>
				</c:if>


					<%--如果不是最后一页--%>
					<c:if test="${pb.currentPage!=pb.totalPage}">
						<li>
							<a href="${pageContext.request.contextPath}/product?methodName=getProductByPage&curPage=${pb.currentPage+1}&pSize=12&cid=${param.cid}" aria-label="Next">
								<span aria-hidden="true">&raquo;</span>
							</a>
						</li>
					</c:if>

			</ul>
		</div>
		<!-- 分页结束=======================        -->

		<!--
       		商品浏览记录:
        -->
		<div style="width:1210px;margin:0 auto; padding: 0 9px;border: 1px solid #ddd;border-top: 2px solid #999;height: 246px;">

			<h4 style="width: 50%;float: left;font: 14px/30px " 微软雅黑 ";">浏览记录</h4>
			<div style="width: 50%;float: right;text-align: right;"><a href="">more</a></div>
			<div style="clear: both;"></div>

			<div style="overflow: hidden;">

				<ul style="list-style: none;">
					<li style="width: 150px;height: 216;float: left;margin: 0 8px 0 0;padding: 0 18px 15px;text-align: center;"><img src="${pageContext.request.contextPath}/products/1/cs10001.jpg" width="130px" height="130px" /></li>
				</ul>

			</div>
		</div>
		<!--
                        描述：页脚部分
                    -->
			<div class="container-fluid">

				<div style="float: left;margin-left: 30px;margin-top: 25px">
					<img src="${pageContext.request.contextPath}/image/logo-mi2.png" width="80px" height="80px">
				</div>
				<div style="text-align: center;margin-top: 5px;float: left;margin-left: 30px;margin-top: 50px;text-align: center" >
					<ul class="list-inline">
						<li><a href="info.html">小米商城</a></li>|
						<li><a>MIUI</a></li>|
						<li><a>米家</a></li>|
						<li><a>多看</a></li>|
						<li><a>游戏</a></li>|
						<li><a>政企服务</a></li>|
						<li><a>小米天猫店</a></li>|
						<li><a>小米集团隐私政策</a></li>|
						<li><a>小米公司儿童信息保护规则</a></li>|
						<li><a>米家隐私</a></li>|
						<li><a>问题反馈</a></li>|
						<li><a>招贤纳士</a></li>|
						<li><a>投诉建议</a></li>
					</ul>
				</div>
				<div style="clear: both"></div>
				<div  style="text-align: center;margin-top: 5px;margin-bottom:20px;">

					Copyright &copy;2020-2030  Rice mall
				</div>
			</div>

	</body>





		<%--

				jsp的el表达式
							内置对象
								${sessionScope.属性名} session域中取数据
								${requestScope.属性名} request域域中取数据
								${pageScope.属性名} page域中获取数据
								${applicationScope.属性名}  全局(servletContext)获取数据

								${cookie}:---Map<String,Cookie> ${cookie.名称} 获取cookie 对象
								${param} --- Map<String,String> 获取url地址栏上?后面的所有的参数名称以及参数值
									${param.key}获取value


		--%>
		<script>

			//$(function (){

					//获取地址栏所有参数名称以及参数值的内容  url?  key1=value1&key2=value2
				//alert('${param.cid}') ; //{pSize=12, curPage=1, methodName=getProductByPage, cid=1}

			//}) ;
		</script>


</html>